import styles from './index.less';
import { Button, Table } from 'antd';
import { useModel } from 'umi';
import useController from './../../utils/VM/useController';
import Ctrl from './index.ctrl';
import { useEffect, useLayoutEffect } from 'react';
import { useState } from 'react';
import tableService from '@/services/tableService';

export default function IndexPage() {
  const { initialState, loading, error, refresh, setInitialState } =
    useModel('@@initialState');
  const vm = useController<Ctrl>(Ctrl);

  const columns = [
    {
      title: '姓名',
      dataIndex: 'name',
      key: 'name',
    },
    {
      title: '年龄',
      dataIndex: 'age',
      key: 'age',
    },
    {
      title: '住址',
      dataIndex: 'address',
      key: 'address',
    },
  ];

  useEffect(() => {
    vm.getList();
  }, []);
  console.log(vm.data, 'vm.data.aaalist ');
  const data = [
    { name: '1', age: 10, address: 'address' },
    { name: '2', age: 10, address: 'address' },
    { name: '3', age: 10, address: 'address' },
    { name: '4', age: 10, address: 'address' },
    { name: '5', age: 10, address: 'address' },
    { name: '6', age: 10, address: 'address' },
    { name: '7', age: 10, address: 'address' },
    { name: '8', age: 10, address: 'address' },
    { name: '9', age: 10, address: 'address' },
    { name: '10', age: 10, address: 'address' },
    { name: '11', age: 10, address: 'address' },
  ];
  return (
    <div>
      <Table rowKey="name" dataSource={data} columns={columns} />
    </div>
  );
}
